package org.ting.e_commerce.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.ting.e_commerce.model.Store;

import java.util.List;

@Mapper
public interface StoreMapper {
    @Insert("insert into store(user_id, store_name, store_introduction, contact_info) " +
            "values (#{userId}, #{storeName}, #{storeIntroduction}, #{contactInfo})")
    boolean addStore(Store store);

    @Select("select * from store where user_id = #{userId}")
    List<Store> selectByUserId(int userId);

    @Select("select * from store where store_name = #{storeName}")
    Store selectByStoreName(String storeName);
    @Select("select * from store where store_id = #{store_id}")
    Store selectById(int storeId);
    @Select("select * from store where user_id = #{userId} and store_id = #{storeId}")
    Store selectByUserIdAndStoreId(int userId, int storeId);
    boolean updateStoreByStoreId(Store store);
}
